import { Key } from "react";
import { request } from "@/utils/http";
// 引入限制的样式
import type {
  getHosSetListParamsType,
  getHosSetListReturnType,
  addHosSetListParamsType,
  getHosSetListItemsType,
} from "./model/hospitalSetTypes";
// 发送请求
export const getHosSetListRequest = ({
  page,
  limit,
  hosname,
  hoscode,
}: getHosSetListParamsType) => {
  //返回的值做限制 第一个参数时路径 限制为any 第二个参数时传参 做限制
  return request.get<any, getHosSetListReturnType>(
    `/admin/hosp/hospitalSet/${page}/${limit}`,
    {
      params: {
        hosname,
        hoscode,
      },
    }
  );
};
// 添加的post请求
export const addHosSetListRequest = (data: addHosSetListParamsType) => {
  return request.post<any, null>("/admin/hosp/hospitalSet/save", data);
};
// 医院设置中 根据id获取某个详细的医院设置
export const GetInformationAccordingToID = (id: string) => {
  return request.get<any, getHosSetListItemsType>(
    `/admin/hosp/hospitalSet/get/${id}`
  );
};
//医院设置中 根据id修改数据后，再次提交修改
export const updateHosSetFromIdRequest = (
  data: addHosSetListParamsType,
  id?: string
) => {
  return request.put<any, null>("/admin/hosp/hospitalSet/update", data);
};
//医院设置中 根据id删除当条数据
export const DeleteDataAccordingToIdRequest = (id: string) => {
  return request.delete<any, null>(`/admin/hosp/hospitalSet/remove/${id}`);
};
// 医院设置中根据id批量删除数据
export const BatchDeleteDataRequest = (idList: Key[]) => {
  return request.delete<any, null>(`/admin/hosp/hospitalSet/batchRemove`, {
    data: idList,
  });
};
